﻿/// Write a program that reads a text file containing a list of strings, sorts them and saves them to another text file.
/// Example:
///	Ivan			George
///	Peter			Ivan
///	Maria			Maria
///	George			Peter

using System;
using System.Collections.Generic;
using System.IO;


namespace c_sh_II_lek_6_files
{
    class zad6
    {
        static void Main()
        {
            string input = @"..\..\input.txt";
            string output = @"..\..\output.txt";
            string line;
            List<string> inStrigs = new List<string>();

            using (StreamReader sr = new StreamReader(input))
            {
                line = sr.ReadLine();

                while (line != null)
                {
                    inStrigs.Add(line);
                    line = sr.ReadLine();
                }
            }

            inStrigs.Sort();
            
            using(StreamWriter sw = new StreamWriter(output))
	        {
                foreach (var item in inStrigs)
                {
                    sw.WriteLine(item);
                }
	        }
        }
    }
}
